home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_04
/
8n04099a
< prev
next >
Wrap
Text File
|
1990-03-18
|
1KB
|
51 lines
********************************************************
This scheduler treats LEVEL1 as the highest level of priority.
IDLE tests greater than all other levels.
struct actions {
int priority;
void (*action)();
char * arg;
struct actions *nxtptr;
} ready [MAX_WAIT], next;
main ()
{
...
/* initiate interrupt handlers */
while (TRUE){
clevel = IDLE;
do_loop();
}
}
void do_loop()
{
scheduler:
if (clevel == LEVEL2) return;
else if ((clevel > LEVEL2) && (getnext(LEVEL2) != EMPTY)){
push (clevel);
clevel == LEVEL2; /*should be locked */
(*next.action)(next.arg);
clevel=pop(); /*lock*/
goto scheduler;
}
else if ((clevel > LEVEL3) && (getnext(LEVEL3) != EMPTY)){
push (clevel);
clevel == LEVEL3; /*lock*/
(*next.action)(next.arg);
clevel=pop(); /*lock*/
goto scheduler;
}
else return;
}
*********************LISTING 6*************************